package crmsystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import crmsystem.dao.ContractDao;
import crmsystem.entity.ContractEntity;
import crmsystem.service.ContractService;
import crmsystem.utils.PageUtils;
import crmsystem.utils.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("contractService")
public class ContractServiceImpl extends ServiceImpl<ContractDao, ContractEntity> implements ContractService {

    @Autowired
    ContractDao contractDao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<ContractEntity> page = this.page(
                new Query<ContractEntity>().getPage(params),
                new QueryWrapper<ContractEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<ContractEntity> getByIndex(String index) {
        return contractDao.selectByIndex(index);
    }

}